<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta http-equiv="Pragma" content="no-cache" />
        <meta http-equiv="Cache-Control" content="no-cache" />
        <meta http-equiv="Expires" content="0" />
        <meta http-equiv="X-UA-Compatible" content="E=edge;chrome=1" />
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
        <title>嘉华金融</title>
        <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/reset.css">
        <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/weui.min.css">
        <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/index.css">
        <script type="text/javascript" src="<%=path%>/static/js/jquery-3.2.1.min.js"></script>
        <script type="text/javascript" src="<%=path%>/static/js/weui.min.js"></script>
        <script type="text/javascript" src="<%=path%>/static/layer/layer.js"></script>
    </head>
<body>
    <div>
        <div class="header">
            <div><div class="back"></div></div>
            <div>收入统计</div>
            <div></div>
        </div>
        <div class="main">
            <div class="income-wrap">
                <div class="income-bar border-bottom">
                    <div class="searchbar left">
                        <input class="weui-input left data">
                        <div class="cal left" id="showDatePicker"></div>
                    </div>
                    <div class="search-btn weui-btn weui-btn_mini right" onclick="select()">查询</div>
                </div>
                <div class="weui-cells">
                    <div class="weui-cell dealer-height">
                        <div class="weui-cell__hd"></div>
                        <div class="weui-cell__bd">
                            <p>${date}月推广收益</p>
                        </div>
                        <div class="weui-cell__ft">+&yen;${sum}</div>
                    </div>
                    
                    <div class="weui-cell">
                        <div class="weui-cell__hd"></div>
                        <div class="weui-cell__bd">
                            <p>收益明细</p>
                        </div>
                    </div>
                    <c:forEach items="${bUserIncome}" var="item" varStatus="vs">
                    <div class="weui-cell">
                        <div class="weui-cell__hd income-title">
                         <c:choose> 
	                       <c:when test="${item.type eq 'register'}">
	                          <p>推荐注册收益</p>
	                       </c:when>
	                       <c:otherwise>
	                          <p>分销收益</p>
	                       </c:otherwise>
                        </c:choose>
                           
                            <p><fmt:formatDate value="${item.createTime}" pattern="yyyy-MM-dd"/></p>
                        </div>
                        <div class="weui-cell__bd home-p"></div>
                        <div class="weui-cell__ft">
                            <div class="money" style="color:blue">+&yen;${item.income}</div>
                        </div>
                    </div>
                    </c:forEach>
                    <c:forEach items="${withLists}" var="item" varStatus="vs">
                    <div class="weui-cell">
                        <div class="weui-cell__hd income-title">                        
                              <p>提现</p>                          
                            <p><fmt:formatDate value="${item.createTime}" pattern="yyyy-MM-dd"/></p>
                        </div>
                        <div class="weui-cell__bd home-p"></div>
                        <div class="weui-cell__ft">
                            <div class="money" style="color:red">-&yen;${item.number}</div>
                        </div>
                    </div>
                    </c:forEach>
                </div>
            </div>
        </div>
    </div>
<script type="text/javascript">
var date="";
var path="<%=path%>"
$('#showDatePicker').on('click', function () {
    weui.datePicker({
        start: 1990,
        end: new Date().getFullYear(),
        onChange: function() {
            $('.weui-picker__bd').children().eq(2).css("display","none")
        },
        onConfirm: function (result) {
            var year = result[0] + "年";
            var month = result[1] + "月"
            date=result[0]+"-"+ result[1];
            $(".data").val(year + month)
        }
    });
});

 function select(){
    if( $(".data").val()!=""){
    	window.location=path+"/member/incomeStatistics.html?date="+date;
    }
 }
 
 $('.back').on('click', function () {
	 window.location=path+"/member/memberCenter.html";
 });
 
 

</script> 
</body>
</html>
